package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-06-24
 * Time: 18:01
 */
public class BookList {

    private Book[]  books=new Book[20];
    private int usedSize;//实时记录当前books这个数组当中有多少本书


    public BookList(){
         books[0]=new Book("白夜行","东野圭吾",60,"悬疑推理");
         books[1]=new Book("嫌疑人X的献身","东野圭吾",80,"悬疑推理");
         books[2]=new Book("彷徨之刃","东野圭吾",120,"悬疑推理");
         usedSize=3;

    }
    //根据书的位置，拿到这本书
    public Book getBook(int pos){
        return books[pos];
    }
    /*
    * 新增书，POS是要放的位置
    * book是你要放的书
    * */
    public void setBooks( int pos , Book  book){
        books[pos]=book;
    }
    /*
    *
    * 实时获取当前的书的个数
    *
    * */
    public int getUsedSize(){
        return usedSize;
    }
    /*
    * 实时修改当前书架上的书的个数
    *
    * */
    public  void   setUsedSize(int size){
        usedSize=size;
    }
}
